<?php

class Application_Plotter
{
	protected $_params;
	public $errors;
	
	public function __construct($params = null) {
		$this->_params = $params;
		$this->errors = false;
		$this->_init();
	}
	
	public function plot() {
		$graphPlotter = new $this->_params['graph']($this->_params);
		return $graphPlotter->call();
	}

	protected function _init() {
		if (!empty($this->_params['graph'])) {
			try {
				@Zend_Loader::loadClass(ucfirst($this->_params['graph']), dirname(__FILE__).'/Plotter');
			} catch (Zend_Exception $ze) {
				$this->errors = "No Class: " . ucfirst($this->_params['graph']);
			}
		}
		else 
			$this->errors = "Bad arguments";
	}
}

